<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>SemOpt: src/PreferredExtension.cpp Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">SemOpt
   &#160;<span id="projectnumber">0.2alpha5-SCC</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('PreferredExtension_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">src/PreferredExtension.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;PreferredExtension.h&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="comment">/* utilizzati per la configurazione di semopt. NON elegante piazzarli qui, ma vabbè amen.</span>
<a name="l00013"></a>00013 <span class="comment">         WARNING: non togliere/spostare/nulla, ti prego!!! si incasina tutto e il make piange :( */</span>
<a name="l00014"></a><a class="code" href="semopt_8h.html#a398527b3e9e358c345c5047b16871957">00014</a> <span class="keywordtype">bool</span> debug = <span class="keyword">false</span>;
<a name="l00015"></a>00015 <span class="keywordtype">bool</span> externalsat = <span class="keyword">true</span>;
<a name="l00016"></a>00016 <span class="keywordtype">string</span> satsolver;
<a name="l00017"></a>00017 <span class="keywordtype">int</span> labellingconditions = 0;
<a name="l00018"></a>00018 <span class="keywordtype">bool</span> manualopt = <span class="keyword">false</span>;
<a name="l00019"></a>00019 <span class="keywordtype">string</span> inputfile;
<a name="l00020"></a>00020 <span class="keywordtype">string</span> semantics;
<a name="l00021"></a>00021 time_t start;
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="comment">//#define DEBUG 0 // 0: no debug. 1: minimal. 2: verbose. &gt;3: more verbose...</span>
<a name="l00024"></a>00024 <span class="comment">//#define TEMP_FIX_NUMBERS // parsing di grafo artificiosamente corretto sui numeri, per problema tarjan.</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="comment">//TODO documentation</span>
<a name="l00027"></a>00027 PreferredExtension::PreferredExtension(<span class="keywordtype">string</span> graphPath) {
<a name="l00028"></a>00028         inputfile = string(graphPath);
<a name="l00029"></a>00029         this-&gt;framework = <a class="code" href="classAF.html" title="Class encompassing an Argumentation Framework.">AF</a>();
<a name="l00030"></a>00030         this-&gt;preferred=<a class="code" href="classPreferred.html" title="use it to compute the algorithm prefSAT">Preferred</a>();
<a name="l00031"></a>00031         <span class="keywordflow">if</span> (!framework.readFile(inputfile)){
<a name="l00032"></a>00032                 cout &lt;&lt; <span class="stringliteral">&quot;cannot read the file&quot;</span> &lt;&lt; endl;
<a name="l00033"></a>00033                 exit(1);
<a name="l00034"></a>00034         }
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="comment">//TODO documentation</span>
<a name="l00038"></a>00038 <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a> PreferredExtension::handlePref() {
<a name="l00039"></a>00039         <span class="keywordflow">return</span> Pref(*framework.get_arguments(), *framework.get_arguments());
<a name="l00040"></a>00040 }
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="comment">//TODO documentation</span>
<a name="l00043"></a>00043 <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a> PreferredExtension::Pref(<a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> G, <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> C) {
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="preprocessor">        #if DEBUG &gt; 0</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>                cout &lt;&lt; <span class="stringliteral">&quot;PREF starts with G = &quot;</span> &lt;&lt; endl;
<a name="l00047"></a>00047                 G.<a class="code" href="classSetArguments.html#a97ce4b4815433f7c573a5922eaec190d" title="per ogni nodo del grafo, stampa l&#39;insieme dei suoi nodi attaccanti e di quelli attaccati.">printNodeRelations</a>();
<a name="l00048"></a>00048 <span class="preprocessor">        #endif</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050         <span class="comment">//represents the initial area where to store the results of Grounded. After that, tempe will be added to Ep</span>
<a name="l00051"></a>00051         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> tempe;
<a name="l00052"></a>00052         <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a> Ep;
<a name="l00053"></a>00053         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> O;
<a name="l00054"></a>00054         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> I;
<a name="l00055"></a>00055         <span class="comment">//represents the set &quot;e&quot; of the general algorithm</span>
<a name="l00056"></a>00056         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> e;
<a name="l00057"></a>00057 
<a name="l00058"></a>00058         <span class="comment">/* **************** GROUNDED *********************/</span>
<a name="l00059"></a>00059 
<a name="l00060"></a>00060         Grounded::doGrounded(G, C, &amp;tempe, &amp;I);
<a name="l00061"></a>00061         Ep=<a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a>();
<a name="l00062"></a>00062         Ep.<a class="code" href="classSetArgumentsList.html#ac04d83b12667ba8a9ae8990f0a789035" title="add a new SetArguments in this set">push_back</a>(&amp;tempe);  <span class="comment">// Ep &lt;- {e}</span>
<a name="l00063"></a>00063 <span class="preprocessor">        #if DEBUG &gt; 0</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>                cout &lt;&lt; <span class="stringliteral">&quot;Dopo Grounded, Ep = &quot;</span> &lt;&lt; e &lt;&lt;endl;
<a name="l00065"></a>00065 <span class="preprocessor">        #endif</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span>        <span class="keywordflow">if</span> (!I.<a class="code" href="classSetArguments.html#a66d5b1cc6b684700c2394a8cf62ef7f0" title="Retuns the cardinality of this set.">cardinality</a>()) {
<a name="l00067"></a>00067 <span class="preprocessor">                #if DEBUG &gt; 0</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>                        cout &lt;&lt; <span class="stringliteral">&quot;Pref si arresta correttamente dopo Grounded. Ep = {e}&quot;</span> &lt;&lt; endl &lt;&lt;<span class="stringliteral">&quot;e:\t&quot;</span> &lt;&lt; e &lt;&lt; endl;
<a name="l00069"></a>00069 <span class="preprocessor">                #endif</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span>                <span class="keywordflow">return</span> Ep;
<a name="l00071"></a>00071         }
<a name="l00072"></a>00072         <span class="comment">/* **************** RESTRICT TO  *****************/</span>
<a name="l00073"></a>00073 
<a name="l00074"></a>00074         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> res;
<a name="l00075"></a>00075         G.<a class="code" href="classSetArguments.html#a58ec72f524211aaf319f6d50a2ab18ce" title="return all nodes contained in the caller set also contained in other.">setSafeRestrict</a>(&amp;I, &amp;res);
<a name="l00076"></a>00076         G = res;
<a name="l00077"></a>00077 
<a name="l00078"></a>00078         <span class="comment">/* **************** SCCSEQ ***********************/</span>
<a name="l00079"></a>00079 
<a name="l00080"></a>00080 <span class="preprocessor">        #ifdef TEMP_FIX_NUMBERS</span>
<a name="l00081"></a>00081 <span class="preprocessor"></span>                <a class="code" href="classAF.html" title="Class encompassing an Argumentation Framework.">AF</a> framework_r = <a class="code" href="classAF.html" title="Class encompassing an Argumentation Framework.">AF</a>();
<a name="l00082"></a>00082                 <span class="keywordflow">if</span> (!framework_r.<a class="code" href="classAF.html#a40b85b5c4cb3d96273dd0becacad1a79" title="Method for parsing a ASPARTIX compliant file.">readFile</a>(<span class="keywordtype">string</span>(<span class="stringliteral">&quot;test-input/esempio1_ristretto.dl&quot;</span>)))
<a name="l00083"></a>00083                         exit(1);
<a name="l00084"></a>00084                 <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> gamma_r = *framework_r.<a class="code" href="classAF.html#ac415a440c526e9a06a938544503fe741" title="Returns a pointer to the set of arguments.">get_arguments</a>();
<a name="l00085"></a>00085                 G.<a class="code" href="classSetArguments.html#a97ce4b4815433f7c573a5922eaec190d" title="per ogni nodo del grafo, stampa l&#39;insieme dei suoi nodi attaccanti e di quelli attaccati.">printNodeRelations</a>();
<a name="l00086"></a>00086                 gamma_r.<a class="code" href="classSetArguments.html#a97ce4b4815433f7c573a5922eaec190d" title="per ogni nodo del grafo, stampa l&#39;insieme dei suoi nodi attaccanti e di quelli attaccati.">printNodeRelations</a>();
<a name="l00087"></a>00087                 G = gamma_r;
<a name="l00088"></a>00088 <span class="preprocessor">        #endif</span>
<a name="l00089"></a>00089 <span class="preprocessor"></span>
<a name="l00090"></a>00090         vector&lt;SetArguments*&gt; sccSet = vector&lt;SetArguments*&gt;();
<a name="l00091"></a>00091         SCCSEQ::performSCCSEQ(&amp;G, &amp;sccSet);
<a name="l00092"></a>00092 
<a name="l00093"></a>00093         cout &lt;&lt; <span class="stringliteral">&quot;*************** SCCSEQ ***************&quot;</span>&lt;&lt;endl;
<a name="l00094"></a>00094         <span class="keywordflow">for</span> (<span class="keyword">auto</span> it=sccSet.begin();it!=sccSet.end();it++){
<a name="l00095"></a>00095                 cout &lt;&lt; <span class="stringliteral">&quot;set in SCCSET: &quot;</span> &lt;&lt; **it &lt;&lt; endl;
<a name="l00096"></a>00096         }
<a name="l00097"></a>00097         cout &lt;&lt; <span class="stringliteral">&quot;--------------------------------------&quot;</span>&lt;&lt;endl;
<a name="l00098"></a>00098 
<a name="l00099"></a>00099         <span class="comment">/* for i &lt;- 1 to length[S]</span>
<a name="l00100"></a>00100 <span class="comment">                EP&#39; &lt;- emptySet</span>
<a name="l00101"></a>00101 <span class="comment">                for each e in EP</span>
<a name="l00102"></a>00102 <span class="comment">                        (O, I) &lt;- boundcond(G, S[i], e)</span>
<a name="l00103"></a>00103 <span class="comment">                        if O = emptySet</span>
<a name="l00104"></a>00104 <span class="comment">                                if I &lt;&gt; emptySet</span>
<a name="l00105"></a>00105 <span class="comment">                                        E* &lt;- SATPref(G down S[i], I intersect C)</span>
<a name="l00106"></a>00106 <span class="comment">                                else</span>
<a name="l00107"></a>00107 <span class="comment">                                        E* &lt;- emptySet</span>
<a name="l00108"></a>00108 <span class="comment">                        else</span>
<a name="l00109"></a>00109 <span class="comment">                                E* &lt;- Pref(G down (S[i]\O), I intersect C)</span>
<a name="l00110"></a>00110 <span class="comment">                        EP&#39; &lt;- EP&#39; join (e circlecross E*)</span>
<a name="l00111"></a>00111 <span class="comment">                EP &lt;- EP&#39;</span>
<a name="l00112"></a>00112 <span class="comment">        return EP</span>
<a name="l00113"></a>00113 <span class="comment">         */</span>
<a name="l00114"></a>00114 
<a name="l00115"></a>00115         <span class="comment">/* **************** PREF&#39;S FOR **********************/</span>
<a name="l00116"></a>00116 
<a name="l00117"></a>00117         <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i_s = 0; i_s&lt;sccSet.size(); i_s++) {
<a name="l00118"></a>00118 
<a name="l00119"></a>00119                 cout &lt;&lt; <span class="stringliteral">&quot;************************* sccSet: &quot;</span>&lt;&lt; *sccSet.at(i_s) &lt;&lt;<span class="stringliteral">&quot; *************************************&quot;</span>&lt;&lt;endl;
<a name="l00120"></a>00120                 cout &lt;&lt; <span class="stringliteral">&quot;Ep: &quot;</span>&lt;&lt; Ep &lt;&lt; endl;
<a name="l00121"></a>00121                 cout &lt;&lt; <span class="stringliteral">&quot;Ep.size: &quot;</span>&lt;&lt; Ep.<a class="code" href="classSetArgumentsList.html#ab1789b23810da76e65fd902183529638" title="the size of this set of SetArguments">size</a>() &lt;&lt; endl;
<a name="l00122"></a>00122                 <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a> Ep_new = <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a>();
<a name="l00123"></a>00123                 <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a> E_star = <a class="code" href="classSetArgumentsList.html" title="Class representing a vector of labelling assignment.">SetArgumentsList</a>();
<a name="l00124"></a>00124 
<a name="l00125"></a>00125                 <span class="comment">//TODO in futuro sostituire la notazione i++ con gli iteratori: aumentano le performance dell&#39;algoritmo!</span>
<a name="l00126"></a>00126                 <span class="keywordflow">for</span>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i_e = 0; i_e&lt;Ep.<a class="code" href="classSetArgumentsList.html#ab1789b23810da76e65fd902183529638" title="the size of this set of SetArguments">size</a>(); i_e++) {
<a name="l00127"></a>00127 
<a name="l00128"></a>00128                         cout &lt;&lt;<span class="stringliteral">&quot;+++++++++++++++++ e: &quot;</span>&lt;&lt;*Ep.<a class="code" href="classSetArgumentsList.html#ae4695dd5a00286692e6b7903ec017f18" title="the SetArguments positioned to i index">at</a>(i_e)&lt;&lt;<span class="stringliteral">&quot; +++++++++++++++++++++++&quot;</span>&lt;&lt;endl;
<a name="l00129"></a>00129 <span class="preprocessor">                        #if DEBUG &gt; 0</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span>                                cout &lt;&lt; <span class="stringliteral">&quot;calling boundcond with A = G = &quot;</span> &lt;&lt;endl;
<a name="l00131"></a>00131                                 G.<a class="code" href="classSetArguments.html#a97ce4b4815433f7c573a5922eaec190d" title="per ogni nodo del grafo, stampa l&#39;insieme dei suoi nodi attaccanti e di quelli attaccati.">printNodeRelations</a>();
<a name="l00132"></a>00132                                 cout &lt;&lt; <span class="stringliteral">&quot;calling boundcond with B = S[&quot;</span>&lt;&lt;i_s&lt;&lt;<span class="stringliteral">&quot;] = &quot;</span> &lt;&lt;endl;
<a name="l00133"></a>00133                                 sccSet.at(i_s)-&gt;printNodeRelations();
<a name="l00134"></a>00134                                 cout &lt;&lt; <span class="stringliteral">&quot;calling boundcond with C = Ep[&quot;</span>&lt;&lt;i_e&lt;&lt;<span class="stringliteral">&quot;] = &quot;</span> &lt;&lt;endl;
<a name="l00135"></a>00135                                 cout &lt;&lt; e;
<a name="l00136"></a>00136                                 <span class="comment">//Ep[i_e].printNodeRelations();</span>
<a name="l00137"></a>00137 <span class="preprocessor">                        #endif</span>
<a name="l00138"></a>00138 <span class="preprocessor"></span>                        I = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00139"></a>00139                         O = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00140"></a>00140                         e = *Ep.<a class="code" href="classSetArgumentsList.html#ae4695dd5a00286692e6b7903ec017f18" title="the SetArguments positioned to i index">at</a>(i_e);
<a name="l00141"></a>00141 
<a name="l00142"></a>00142                         Boundcond::doBoundcond(&amp;G, sccSet.at(i_s), &amp;e, &amp;O, &amp;I);
<a name="l00143"></a>00143 
<a name="l00144"></a>00144                         cout &lt;&lt; <span class="stringliteral">&quot;boundcond(Gamma, &quot;</span>&lt;&lt;*sccSet.at(i_s)&lt;&lt;<span class="stringliteral">&quot;, &quot;</span>&lt;&lt; e&lt;&lt;<span class="stringliteral">&quot;); &quot;</span>&lt;&lt;endl;
<a name="l00145"></a>00145                         cout &lt;&lt; <span class="stringliteral">&quot;O: &quot;</span>&lt;&lt; O&lt;&lt;endl;
<a name="l00146"></a>00146                         cout &lt;&lt; <span class="stringliteral">&quot;I: &quot;</span>&lt;&lt; I&lt;&lt;endl;
<a name="l00147"></a>00147 
<a name="l00148"></a>00148 <span class="preprocessor">                        #if DEBUG &gt; 0</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span>                                cout &lt;&lt; <span class="stringliteral">&quot;exited boundcond.&quot;</span> &lt;&lt;endl&lt;&lt;endl;
<a name="l00150"></a>00150 <span class="preprocessor">                        #endif</span>
<a name="l00151"></a>00151 <span class="preprocessor"></span>
<a name="l00152"></a>00152                         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> Gamma_Down_Si;
<a name="l00153"></a>00153                         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> Gamma_Down_Si_Minus_O;
<a name="l00154"></a>00154                         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> I_Intersect_C;
<a name="l00155"></a>00155                         <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a> Si_Minus_O;
<a name="l00156"></a>00156 
<a name="l00157"></a>00157                         <span class="keywordflow">if</span> (O.empty()) {
<a name="l00158"></a>00158                                 <span class="keywordflow">if</span> (!I.<a class="code" href="classSetArguments.html#a91e548daa6d0859946c8604b1ebb8c5a" title="Check wether or not this set is empty.">empty</a>()) {
<a name="l00159"></a>00159 
<a name="l00160"></a>00160                                         Gamma_Down_Si = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00161"></a>00161                                         I_Intersect_C = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00162"></a>00162                                         G.<a class="code" href="classSetArguments.html#a58ec72f524211aaf319f6d50a2ab18ce" title="return all nodes contained in the caller set also contained in other.">setSafeRestrict</a>(sccSet.at(i_s), &amp;Gamma_Down_Si);
<a name="l00163"></a>00163                                         I.<a class="code" href="classSetArguments.html#ae6761b6c360e440de55c2060ae70981c" title="Intersect this set the `other` set and write the result in `res`.">intersect</a>(&amp;C, &amp;I_Intersect_C);
<a name="l00164"></a>00164                                         cout &lt;&lt;<span class="stringliteral">&quot;G down Si: &quot;</span> &lt;&lt; Gamma_Down_Si &lt;&lt;endl;
<a name="l00165"></a>00165                                         cout &lt;&lt;<span class="stringliteral">&quot;I intersect C: &quot;</span>&lt;&lt;I_Intersect_C&lt;&lt;endl;
<a name="l00166"></a>00166 
<a name="l00167"></a>00167                                         this-&gt;preferred.prefSAT(&amp;Gamma_Down_Si, &amp;I_Intersect_C);
<a name="l00168"></a>00168                                         E_star=*this-&gt;preferred.getSolution();
<a name="l00169"></a>00169 
<a name="l00170"></a>00170                                         cout &lt;&lt; <span class="stringliteral">&quot;prefSAT(&quot;</span>&lt;&lt; Gamma_Down_Si &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; I_Intersect_C&lt;&lt;<span class="stringliteral">&quot; )&quot;</span>&lt;&lt;endl;
<a name="l00171"></a>00171                                         cout &lt;&lt; <span class="stringliteral">&quot;soluzione E_star dopo prefSAT: &quot;</span>&lt;&lt; E_star &lt;&lt; endl;
<a name="l00172"></a>00172 <span class="preprocessor">                                        #if DEBUG &gt; 0</span>
<a name="l00173"></a>00173 <span class="preprocessor"></span>                                                <span class="keywordflow">for</span>(<span class="keyword">auto</span> it1=this-&gt;preferred.begin(); it1!=this-&gt;preferred.end(); it1++) {
<a name="l00174"></a>00174                                                         <a class="code" href="classLabelling.html" title="Class representing a single labelling assignment.">Labelling</a> lab = *it1;
<a name="l00175"></a>00175                                                         cout &lt;&lt; <span class="stringliteral">&quot;*********** NUOVO INSIEME : &quot;</span> &lt;&lt; lab &lt;&lt; endl;
<a name="l00176"></a>00176                                                         <span class="comment">// TODO empiricamente sembra che nell&#39;output previsto ci sia l&#39;unione di ALMENO in e out.</span>
<a name="l00177"></a>00177                                                         <span class="comment">//non ho conoscenza su undec, almeno finora. È DA TESTAR PESANTEMENTE! */</span>
<a name="l00178"></a>00178                                                         cout &lt;&lt; <span class="stringliteral">&quot;inargs= &quot;</span> &lt;&lt; *lab.<a class="code" href="classLabelling.html#af8aa0d976a665c1a9ebbdb801d0a867d" title="Returns the set of arguments labelled as `in`.">inargs</a>() &lt;&lt;<span class="stringliteral">&quot;, outargs= &quot;</span> &lt;&lt; *lab.<a class="code" href="classLabelling.html#afc828a13d1a3e406f56fa1f212b4824d" title="Returns the set of arguments labelled as `out`.">outargs</a>() &lt;&lt;<span class="stringliteral">&quot;, undecargs =&quot;</span> &lt;&lt; *lab.<a class="code" href="classLabelling.html#aedf4e3c3b0150317e5350945f088a424" title="Returns the set of arguments labelled as `undec`.">undecargs</a>();
<a name="l00179"></a>00179                                                         cout &lt;&lt; endl &lt;&lt; <span class="stringliteral">&quot;E* was: &quot;</span> &lt;&lt; E_star &lt;&lt; endl;
<a name="l00180"></a>00180                                                         E_star.<a class="code" href="classSetArgumentsList.html#ac04d83b12667ba8a9ae8990f0a789035" title="add a new SetArguments in this set">push_back</a>(&amp;lab);
<a name="l00181"></a>00181                                                         cout &lt;&lt; <span class="stringliteral">&quot;E* now: &quot;</span> &lt;&lt; E_star &lt;&lt; endl;
<a name="l00182"></a>00182                                                         <span class="comment">//for(iterator it_args = lab.labelling.begin(); it_args!=lab.labelling.end(); it_args++)</span>
<a name="l00183"></a>00183                                                                 <span class="comment">//cout &lt;&lt; &quot;labelling: &quot; &lt;&lt; *(it_args) &lt;&lt; endl;</span>
<a name="l00184"></a>00184                                                 }
<a name="l00185"></a>00185 <span class="preprocessor">                                        #endif</span>
<a name="l00186"></a>00186 <span class="preprocessor"></span>                                }
<a name="l00187"></a>00187                                 <span class="comment">// else, E* &lt;- emptySet is implicit from initialization</span>
<a name="l00188"></a>00188                         }
<a name="l00189"></a>00189                         <span class="keywordflow">else</span> {<span class="comment">//O empty else</span>
<a name="l00190"></a>00190                                 Gamma_Down_Si_Minus_O = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00191"></a>00191                                 Si_Minus_O = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00192"></a>00192                                 I_Intersect_C = <a class="code" href="classSetArguments.html" title="Class encompassing a set of arguments.">SetArguments</a>();
<a name="l00193"></a>00193                                 I.<a class="code" href="classSetArguments.html#ae6761b6c360e440de55c2060ae70981c" title="Intersect this set the `other` set and write the result in `res`.">intersect</a>(&amp;C, &amp;I_Intersect_C);
<a name="l00194"></a>00194                                 sccSet.at(i_s)-&gt;setminus(&amp;O, &amp;Si_Minus_O);
<a name="l00195"></a>00195                                 G.<a class="code" href="classSetArguments.html#a58ec72f524211aaf319f6d50a2ab18ce" title="return all nodes contained in the caller set also contained in other.">setSafeRestrict</a>(&amp;Si_Minus_O, &amp;Gamma_Down_Si_Minus_O);
<a name="l00196"></a>00196 
<a name="l00197"></a>00197                                 E_star = this-&gt;Pref(Gamma_Down_Si_Minus_O, I_Intersect_C);
<a name="l00198"></a>00198                         }
<a name="l00199"></a>00199                         <span class="comment">//cout &lt;&lt; &quot;*************** Ep_new computation *******************&quot;&lt;&lt;endl;</span>
<a name="l00200"></a>00200                         cout &lt;&lt; <span class="stringliteral">&quot;E_star: &quot;</span>&lt;&lt; E_star &lt;&lt; endl;
<a name="l00201"></a>00201                         cout &lt;&lt; <span class="stringliteral">&quot;e:      &quot;</span>&lt;&lt; e &lt;&lt; endl;
<a name="l00202"></a>00202                         cout &lt;&lt; <span class="stringliteral">&quot;Ep_new: &quot;</span>&lt;&lt; Ep_new &lt;&lt; endl;
<a name="l00203"></a>00203                         E_star.<a class="code" href="classSetArgumentsList.html#a297fe7cde586e3584369dbeb607dbc69" title="add to all the set in the SetArgumentsList the elements stored in the parameter">addSetArgumentsToAll</a>(&amp;e);
<a name="l00204"></a>00204                         Ep_new = Ep_new + E_star;
<a name="l00205"></a>00205                         cout &lt;&lt; <span class="stringliteral">&quot;e (dopo):&quot;</span>&lt;&lt;e&lt;&lt;endl;
<a name="l00206"></a>00206                         cout &lt;&lt; <span class="stringliteral">&quot;e cross E_star: &quot;</span>&lt;&lt; E_star &lt;&lt; endl;
<a name="l00207"></a>00207                         cout &lt;&lt; <span class="stringliteral">&quot;new Ep_new: &quot;</span> &lt;&lt; Ep_new &lt;&lt; endl;
<a name="l00208"></a>00208                         cout &lt;&lt; <span class="stringliteral">&quot;Ep: &quot;</span>&lt;&lt;Ep &lt;&lt; endl;
<a name="l00209"></a>00209                 }<span class="comment">//end of Ep loop</span>
<a name="l00210"></a>00210                 Ep = Ep_new;
<a name="l00211"></a>00211         }
<a name="l00212"></a>00212 
<a name="l00213"></a>00213         <span class="keywordflow">return</span> Ep;
<a name="l00214"></a>00214 }
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>PreferredExtension.cpp</b>      </li>

    <li class="footer">Generated on Thu Oct 24 2013 17:38:30 for SemOpt by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
